import datetime

import requests

#
webhook = 'https://open.feishu.cn/open-apis/bot/v2/hook/261ac8f140'


def json_to_dict():
    today_time = datetime.datetime.now().strftime('%Y-%m-%d')
    dict_meal = {'code': 0, 'message': '提报成功，XXX已经提报过；', 'data': ''}
    data_hook = {
        "msg_type": "text",
        "content": {
            "text": today_time + " 报餐成功"
        }
    }
    header = {'Content-Type': 'application/json'}
    print(dict_meal.get('code'))
    if dict_meal.get('code') == 0:
        print('提报成功')
        requests.post(url=webhook, json=data_hook, headers=header)


if __name__ == '__main__':
    json_to_dict()
